import { JXDef } from "../conventions/JXCommon";
import { L } from "../Game/Common/Language";
import { JXLocales } from "../Game/Common/Zh";
import MiSdk from "./Third/MiSdk";
import { tyqSDK } from "./tyq-sdk";

//事件打点管理
export default class TyqEventMgr {
    public static tyqEventMgr: TyqEventMgr = null;
    public static getInstance(): TyqEventMgr {
        if (this.tyqEventMgr == null) {
            this.tyqEventMgr = new this();
        }
        return this.tyqEventMgr;
    }
    public static get ins() {
        return this.getInstance();
    }
    //注册事件
    public onRegister() {
        return;
        console.log("event:注册");
    }
    //登陆事件
    public onLogin() {
        return;
        console.log("event:登录");
    }
    //当用户同意用户协议事件
    public onAgreeUseAgree() {
        return;
        console.log("event:同意用户协议");
        MiSdk.getInstance().onUserAgreed();
    }
    //当广告加载成功
    public onAdLoad() {
        return;
        tyqSDK.collectAdAction(1);
    }
    //当广告显示成功
    public onAdShow() {
        return;
        tyqSDK.collectAdAction(2);
    }
    //当用户完整看完广告
    public onAdSuccess() {
        return;
        tyqSDK.collectAdAction(3);
    }
    //当用户取消观看广告
    public onAdCancel() {
        return;
        tyqSDK.collectAdAction(4);
    }

    //发送普通打点事件(新手教程模式下不生效)
    public sendEvent(eventType: string, eventName?: string) {
        return;
        let name = eventName ? eventType + "_" + eventName : eventType;
        this.sendEventPoint(name);
    }
    //发送引导事件
    public sendGuidStep(step) {
        return;
        if (step <= 3) {
            this.sendEventPoint(JXDef.umaPoint.guide + L(JXLocales.tower.guide, step))
        }
        if (step == 4) {
            this.sendEventPoint(JXDef.umaPoint.guide + L(JXLocales.tower.guide, 3));
        }

        if (step == 7) {
            this.sendEventPoint(JXDef.umaPoint.guide + '全部结束');
        }
        this.sendEventPoint("引导_" + step);
    }
    //不管新手引导有没有完成都会发送的事件
    public sendEventPoint(eventName) {
        return;
        tyqSDK.collectClickEvent(eventName);
        console.log("%cevent:" + eventName, "color:#FF7500");
    }
    //开始游戏
    public onStartGame(level: any) {
        return;
        tyqSDK.startGame(level);
        console.log("event:gamestart:", level);
    }
    //结束广告
    public onEndGame(isWin) {
        return;
        tyqSDK.endGame(isWin);
        console.log("event:gameEnd:", isWin);
    }
}